package com.cin.cma.common.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;


@Getter
public enum ShowTypeEnum {
    TWO_DIMENSION("2D", "2D"),
    THREE_DIMENSION("3D", "3D"),
    IMAX("IMAX", "IMAX"),
    IMAX_2D("IMAX2D", "IMAX2D"),
    IMAX_3D("IMAX3D", "IMAX3D"),
    DMAX("DMAX", "DMAX"),
    DMAX_2D("DMAX2D", "DMAX2D"),
    DMAX_3D("DMAX3D", "DMAX3D"),
    FOUR_DIMENSION("4D", "4D"),
    FOUR_DIMENSION_IMAX("4DXIMAX", "4DXIMAX"),
    GIANT_2D("GIANT_2D", "巨幕2D"),
    GIANT_3D("GIANT_3D", "巨幕3D"),
    FILM("FILM", "胶片"),
    OTHER("OTHER", "其他");;
    private final String code;
    private final String desc;

    ShowTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据showType获取枚举
     *
     * @param showType
     * @return
     */
    public static ShowTypeEnum buildShowTypeEnum(String showType) {
        if (StrUtil.isBlank(showType)) {
            return OTHER;
        }

        switch (showType) {
            case "2D":
                return TWO_DIMENSION;
            case "3D":
                return THREE_DIMENSION;
            case "IMAX":
                return IMAX;
            case "IMAX2D":
                return IMAX_2D;
            case "IMAX3D":
                return IMAX_3D;
            case "DMAX":
                return DMAX;
            case "DMAX2D":
                return DMAX_2D;
            case "DMAX3D":
                return DMAX;
            case "4D":
                return FOUR_DIMENSION;
            case "MAX2D":
            case "巨幕2D":
                return GIANT_2D;
            case "MAX3D":
            case "巨幕3D":
                return GIANT_3D;
            case "胶⽚":
                return FILM;
            default:
                return OTHER;
        }
    }
}
